import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.Set;

import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource;
import brut.androlib.res.data.value.ResFileValue;
import brut.androlib.res.decoder.ARSCDecoder;
import brut.androlib.res.decoder.ARSCDecoder.ARSCData;


public class ARSCParser {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String fileName = "D:/temp/resources.arsc";
		try {
			ARSCData data = ARSCDecoder.decode(new FileInputStream(fileName),true,true );
			Iterator<ResResource> it = data.getOnePackage().listFiles().iterator();
			ResResource file = null;
			while(it.hasNext()){
				file = it.next();
				if(file.getValue() instanceof ResFileValue){
					System.out.println(((ResFileValue)file.getValue()).getPath());
				}else{
					System.out.println(">>"+file.getFilePath());
				}
			}
		} catch (AndrolibException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
